package com.metaera.app.ui.popup;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.lxj.xpopup.core.CenterPopupView;
import com.metaera.app.R;
import com.metaera.app.data.model.ProfileResponse;
import com.metaera.app.utils.image.GlideApp;

import androidx.annotation.NonNull;

public class ShareUserPopup extends CenterPopupView {

    private ProfileResponse mResponse;

    public ShareUserPopup(@NonNull Context context) {
        super(context);
    }

    public ShareUserPopup(@NonNull Context context, ProfileResponse response) {
        super(context);
        mResponse = response;
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.popup_share_user;
    }

    @Override
    protected void onCreate() {
        super.onCreate();

        ImageView ivAvatar = findViewById(R.id.iv_avatar);
        TextView tvNickname = findViewById(R.id.tv_nickname);
        TextView tvFollowNumber = findViewById(R.id.tv_follow_number);
        TextView tvFansNumber = findViewById(R.id.tv_fans_number);
        TextView tvViewsNumber = findViewById(R.id.tv_views_number);

        tvNickname.setText(mResponse.getNickname());
        tvFansNumber.setText(String.valueOf(mResponse.getFans_num()));
        tvFollowNumber.setText(String.valueOf(mResponse.getFollow_num()));
        tvViewsNumber.setText(String.valueOf(mResponse.getVisits_num()));

        GlideApp.with(ivAvatar).load(mResponse.getAvatar_img()).avatar().into(ivAvatar);
    }
}
